package com.ruoyi.wcf.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wcf.domain.WcfDisposeBusinessSection;
import com.ruoyi.wcf.service.IWcfDisposeBusinessSectionService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 客户管理-营业区间设置Controller
 *
 * @author ruoyi
 * @date 2022-03-30
 */
@RestController
@RequestMapping("/wcf/wcfDisposeBusinessSection")
public class WcfDisposeBusinessSectionController extends BaseController
{
    @Autowired
    private IWcfDisposeBusinessSectionService wcfDisposeBusinessSectionService;

    /**
     * 查询客户管理-营业区间设置列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeBusinessSection:list')")
    @GetMapping("/list")
    public TableDataInfo list(WcfDisposeBusinessSection wcfDisposeBusinessSection)
    {
        startPage();
        List<WcfDisposeBusinessSection> list = wcfDisposeBusinessSectionService.selectWcfDisposeBusinessSectionList(wcfDisposeBusinessSection);
        return getDataTable(list);
    }

    /**
     * 导出客户管理-营业区间设置列表
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeBusinessSection:export')")
    @Log(title = "客户管理-营业区间设置", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WcfDisposeBusinessSection wcfDisposeBusinessSection)
    {
        List<WcfDisposeBusinessSection> list = wcfDisposeBusinessSectionService.selectWcfDisposeBusinessSectionList(wcfDisposeBusinessSection);
        ExcelUtil<WcfDisposeBusinessSection> util = new ExcelUtil<WcfDisposeBusinessSection>(WcfDisposeBusinessSection.class);
        return util.exportExcel(list, "客户管理-营业区间设置数据");
    }

    /**
     * 获取客户管理-营业区间设置详细信息
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeBusinessSection:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(wcfDisposeBusinessSectionService.selectWcfDisposeBusinessSectionById(id));
    }

    /**
     * 新增客户管理-营业区间设置
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeBusinessSection:add')")
    @Log(title = "客户管理-营业区间设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WcfDisposeBusinessSection wcfDisposeBusinessSection)
    {
        return toAjax(wcfDisposeBusinessSectionService.insertWcfDisposeBusinessSection(wcfDisposeBusinessSection));
    }

    /**
     * 修改客户管理-营业区间设置
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeBusinessSection:edit')")
    @Log(title = "客户管理-营业区间设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WcfDisposeBusinessSection wcfDisposeBusinessSection)
    {
        return toAjax(wcfDisposeBusinessSectionService.updateWcfDisposeBusinessSection(wcfDisposeBusinessSection));
    }

    /**
     * 删除客户管理-营业区间设置
     */
    @PreAuthorize("@ss.hasPermi('wcf:wcfDisposeBusinessSection:remove')")
    @Log(title = "客户管理-营业区间设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wcfDisposeBusinessSectionService.deleteWcfDisposeBusinessSectionByIds(ids));
    }
}
